Skip to content

Conversation

@mlang
Copy link

@mlang mlang commented Jan 11, 2019

Please excuse my ignorance, but I can't see a reason why Nullable,
effectively equal to Maybe, isn't at least a Functor or actually a Monad.
The instance definitions follow quite naturally. I can imagine
this is sort of an artificial barrier to foreign values. However,
to/from maybe conversion for the sake of using one of these instances
seems just wasteful for no particular good reason.

If I am overseeing something blatantly obvious here, it might
be good to document why this is not desireable/allowed.

@garyb
Copy link
Member

garyb commented Jan 11, 2019

It has been suggested before, but yeah rejected. It's not really the same as Maybe, since:

toMaybe (toNullable Nothing) = Nothing
toMaybe (toNullable (Just Nothing)) = Nothing

@mlang
Copy link
Author

mlang commented Jan 11, 2019 via email

@hdgarrood
Copy link
Contributor

Don't worry about it! I would argue that this is not at all obvious until you're aware of the problem, and I agree that this is something which ought to be better documented; see also #2 and #7.

@hdgarrood hdgarrood closed this Jan 11, 2019
@garyb
Copy link
Member

garyb commented Jan 11, 2019

Oops! But yeah, you got it - two layers of Nullable can collapse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants